<%@ page import="com.webtest.javabeantest.Customer" %>
<%@ page import="org.apache.commons.collections4.CollectionUtils" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: lzy
  Date: 2018/8/9
  Time: 14:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Test</title>
</head>
<body>
<table cellspacing="0" cellpadding="10" border="1">
    <tr>
        <th>id</th>
        <th>name</th>
        <th>age</th>
    </tr>
    <%--在页面上对request中的customers属性进行遍历，打印id,name,age--%>
    <%
        @SuppressWarnings("unchecked")
        List<Customer> customers = (List<Customer>) request.getAttribute("customers");
        if (CollectionUtils.isNotEmpty(customers)) {
            for (Customer customer : customers) {
    %>
    <tr>
        <td><%=customer.getId()%>
        </td>
        <td><%=customer.getName()%>
        </td>
        <td><%=customer.getAge()%>
        </td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>
